import 'package:flutter/material.dart';
import 'package:flutter_app/counter/counter_native_connect.dart';
import 'package:flutter_app/stateLearn/click_txt.dart';
import 'package:flutter_app/utils/log_util.dart';
import 'package:get/get.dart';

///author: create by SunJH
///时间: 2021/12/17 0017
///邮箱: 965989158@qq.com
///描述: flutter与Android原生通讯测试
///

class NativeConnect extends GetView<CounterNativeConnect> {
  const NativeConnect({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    Get.put(CounterNativeConnect());
    return Scaffold(
      body: ListView(
        children: [
          Obx(() => Text(controller.printInfoResult.value)),
          Obx(() => Text(controller.fromNativeData.value)),
          ClickTxt(
            info: "发消息到android",onPressed: (){
                controller.sendMessageToAndroid('flutter跨平台通讯测试');
          },
          ),
          ClickTxt(
            info: "调用android方法，触发android回调flutter",onPressed: (){
            controller.nativePrintInfo();
          },
          ),
        ],
      ),
    );
  }
}
